<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/faces/manager/xhtml/templates/template.xhtml">
		<ui:define name="manager-content">
			<p:growl id="perfil_messages" showDetail="true" />
			<table id="manager-content-panel" cellpadding="0" cellspacing="1">
				<tr>
					<td id="manager-content-header">
						<h:form>	
							<p:breadCrumb style="width:810px;">
								<p:menuitem value="#{msg['manager.menu.navigator.home']}"/>
								<p:menuitem ajax="false" value="#{msg['manager.menu.navigator.admin']}" action="/faces/manager/xhtml/main.xhtml"  />
								<p:menuitem ajax="false" value="#{msg['manager.menu.navigator.usuario']}" action="/faces/manager/xhtml/usuario/list.xhtml"  />
								<p:menuitem value="#{msg['manager.menu.navigator.usuario.create']}" />
							</p:breadCrumb>	
						</h:form>
					</td>
				</tr>
				<tr>
					<td id="manager-content-body">
						<h:form id="formUsuario">	
							<p:fieldset legend="#{msg['manager.menu.left.admin.usuario.title']}" styleClass="manager-fieldset-content"> 									
								<p:spacer height="20px" />
								<p:panel>
									<table id="form-create" cellpadding="0" cellspacing="0">							
										<tr>
											<td class="form-column-label">
												<h:outputText value="#{msg['manager.usuario.create.cliente']}" />:
											</td>
											<td class="form-column-value">
												<h:selectOneMenu id="cliente" value="#{usuarioController.usuario.cliente.id}" styleClass="selectOneMenuForm">
													<f:selectItem itemLabel="" itemValue=""/>		               		
								               		<f:selectItems value="#{usuarioController.clientes}" var="cliente" itemLabel="#{cliente.pessoa.nome}" itemValue="#{cliente.id}" />       		
								            	</h:selectOneMenu>
											</td>
											<td class="form-column-error"></td>
										</tr>
										<tr>
											<td class="form-column-label">
												<h:outputText value="#{msg['manager.usuario.create.login']}" />:
											</td>
											<td class="form-column-value">
												<p:inputText id="login" styleClass="inputText" required="true" value="#{usuarioController.usuario.login}"
													label="#{msg['manager.usuario.create.login']}" />
											</td>
											<td class="form-column-error"><p:message for="login" /></td>
										</tr>
										<tr>
											<td class="form-column-label">
												<h:outputText value="#{msg['manager.usuario.create.password']}" />:
											</td>
											<td class="form-column-value">
												<p:password feedback="true" minLength="6" value="#{usuarioController.usuario.senha}" styleClass="inputText"/>											
											</td>
											<td class="form-column-error"></td>
										</tr>	
										<tr>
											<td class="form-column-label">
												<h:outputText value="#{msg['manager.usuario.create.perfil']}" />:
											</td>
											<td class="form-column-value" colspan="2">
												<p:spacer height="10px"/>
												<p:pickList value="#{usuarioController.perfis}" var="perfil" itemLabel="#{perfil.descricao}" 
													itemValue="#{perfil}" converter="#{perfilConverter}" iconOnly="true" 
													showSourceControls="true" showTargetControls="true"/>
											</td>
										</tr>																																									
									</table>
								</p:panel>
								<p:spacer height="20px" />
								<table id="panel-buttons" cellpadding="0" cellspacing="0">
									<tr>
										<td>
											<p:commandButton value="#{msg['manager.usuario.button.save']}"
												action="#{usuarioController.save}" ajax="false" icon="save-button"/>
										</td>
									</tr>
								</table>
								<p:spacer height="5px" />
							</p:fieldset>
						</h:form>
					</td>
				</tr>
			</table>
		</ui:define>
	</ui:composition>
</html>